<?php include 'login/Restrito.php';?>
  <?php
	require_once "banco/ConexaoBanco.php";
	
	$consultar = mysql_query("SELECT * FROM reclamacao ORDER BY id_reclamacao DESC ");
	echo "<h3 align='center'>Lista de Reclamações dos Pacientes</h3>";
  	echo "<hr color='#0066FF' size='3px' >";
	echo "<p align='center' >Para visualizar todo o conteudo clique em detalhes </p>";
	echo '<table border="2" align="center" id="tabela" >';
	
 	echo '<tr bgcolor="#0066FF" align="center" height="35px">';
	echo '<td>Cód.</td>';
	echo '<td>Motivo</td>';
	echo '<td>Paciente</td>';
	echo '<td>Action</td>';
	//echo $consultarUsuarios;
	echo '</tr>';
	
	// popula as tabelas
	while($registro = mysql_fetch_assoc($consultar)){
	echo '<tr>';
	echo "<td>".$registro['id_reclamacao']."</td>";
	echo '<td>'.$registro['rec_motivo'].'</td>';
	$query = mysql_query("SELECT p_nome FROM paciente WHERE id_paciente = ".$registro['paciente_id']);
			while($lista = mysql_fetch_array($query)) { 
			 	echo '<td>'.$lista['p_nome'].'</td>';
			 }
	echo '<td ><center><a href="?p=detalhe-reclamacao&id='.$registro['id_reclamacao'].'"> Detalhes </a></td>';
	echo '</tr>';
	
	}
	
	echo '</table>';
	
	mysql_close();
?>
  <br />
  <br />